home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77566_sh_task.js < prev    next >
Encoding:
Text File  |  2003-02-21  |  28.8 KB  |  1,132 lines

  1. // ==============================================================
  2. //     Microsoft Server Appliance
  3. //  Task-level JavaScript functions
  4. //
  5. // Copyright (c) Microsoft Corporation.  All rights reserved.
  6. //
  7. // ==============================================================
  8.  
  9. <!-- Copyright (c) Microsoft Corporation.  All rights reserved.-->
  10.  
  11.     //-------------------------------------------------------------------------
  12.     // Global Variables
  13.     //-------------------------------------------------------------------------
  14.     var id = 0;
  15.     var sid =0;
  16.     var retrys = 0;
  17.     var maxRetrys = 5;
  18.     var bFooterIsLoaded;
  19.     var bPageInitialized = false;
  20.  
  21.  
  22.     ClearOkayToLeavePage();
  23.  
  24.     //-------------------------------------------------------------------------
  25.     //
  26.     // Function : Task
  27.     //
  28.     // Synopsis : Initialize the Task class
  29.     //
  30.     // Arguments: None
  31.     //
  32.     // Returns  : None
  33.     //
  34.     //-------------------------------------------------------------------------
  35.  
  36.     function TaskObject() {
  37.         // static JScript properties
  38.  
  39.         NavClick = false;
  40.         KeyPress = false;
  41.         PageType = false;
  42.         BackDisabled = false;
  43.         NextDisabled = false;
  44.         FinishDisabled = false;
  45.         CancelDisabled = false;
  46.     }
  47.  
  48.  
  49.     var Task = new TaskObject();
  50.  
  51.     Task.NavClick = false;
  52.     Task.KeyPress = false;
  53.     Task.PageType = false;
  54.     Task.BackDisabled = false;
  55.     Task.NextDisabled = false;
  56.     Task.FinishDisabled = false;
  57.     Task.CancelDisabled = false;
  58.  
  59.  
  60.  
  61.     
  62.     //-------------------------------------------------------------------------
  63.     //
  64.     // Function:    SA_SignalFooterIsLoaded
  65.     //
  66.     // Synopsis:    Signal that the Footer frameset page is loaded. This function is
  67.     //                called by the footer page after it has been loaded. Calling this
  68.     //                function signals to the main page that the navigation bar has
  69.     //                loaded and completed initialization.
  70.     //
  71.     // Arguments:     None
  72.     //
  73.     // Returns  :     None
  74.     //
  75.     //-------------------------------------------------------------------------
  76.     function SA_SignalFooterIsLoaded()
  77.     {
  78.         bFooterIsLoaded=true;
  79.         //SA_TraceOut("SH_TASK", "Footer signaled it was loaded")
  80.     }
  81.  
  82.     
  83.     //-------------------------------------------------------------------------
  84.     //
  85.     // Function:    SA_WaitForFooter
  86.     //
  87.     // Synopsis:    Wait for the Footer frameset page to load and initialize. 
  88.     //
  89.     // Arguments:     None
  90.     //
  91.     // Returns:     None
  92.     //
  93.     //-------------------------------------------------------------------------
  94.     function SA_WaitForFooter()
  95.     {
  96.         //SA_TraceOut("SH_TASK::SA_WaitForFooter()", "Entering")
  97.         //
  98.         // If the footer has not loaded then sleep for 1/2 second and check again.
  99.         if ( !bFooterIsLoaded )
  100.         {
  101.             window.setTimeout("SA_WaitForFooter()",500);
  102.             //SA_TraceOut("SH_TASK::SA_WaitForFooter()", "Exiting, not ready")
  103.              return;
  104.         }
  105.  
  106.         //
  107.         // Footer has loaded, complete initialization of this page
  108.         CompletePageInit();
  109.         
  110.         //SA_TraceOut("SH_TASK::SA_WaitForFooter()", "Exiting, Ready")
  111.     }
  112.  
  113.     
  114.     //-------------------------------------------------------------------------
  115.     //
  116.     // Function:    PageInit
  117.     //
  118.     // Synopsis:    Initialize a web page in the client browser.
  119.     //                
  120.     //                1) Load the Footer frameset with the correct navigation
  121.     //                    bar. Property and Tabbed property pages require
  122.     //                    a nav bar with an OK and Cancel button. Wizard
  123.     //                    pages require Back, Next | Finish, and Cancel.
  124.     //                2) Call WaitForFooter which then waits for the Footer frameset
  125.     //                    page to load. 
  126.     //
  127.     //
  128.     // Arguments:     None
  129.     //
  130.     // Returns:        None
  131.     //
  132.     //-------------------------------------------------------------------------
  133.     function PageInit()
  134.     {
  135.         //SA_TraceOut("SH_Task::PageInit", "Entering")
  136.  
  137.         //
  138.         // Clear the Footer Frameset is loaded flag. This flag is set by the Footer
  139.         // Frameset (SA_SignalFooterIsLoaded) inside the footer frameset page after
  140.         // it has completed it's initialization.
  141.         bFooterIsLoaded = false;
  142.  
  143.         //
  144.         // Need to know what type of page we are serving.
  145.         var taskType = document.frmTask.TaskType.value;
  146.         var wizardPageType = document.frmTask.PageType.value;
  147.  
  148.         //SA_TraceOut("SH_Task::PageInit", "TaskType : " + document.frmTask.TaskType.value);
  149.         //SA_TraceOut("SH_Task::PageInit", "WizardPageType: " + wizardPageType);
  150.         //SA_TraceOut("SH_Task::PageInit", "Forms count: " + document.forms.length );
  151.  
  152.         var oFooter = eval("top.footer");
  153.         if ( oFooter == null )
  154.         {
  155.             if ( SA_IsDebugEnabled() ) 
  156.             {
  157.                 var msg = "Error: The current page will not work correctly because it's being opened without frameset.\n\n";
  158.  
  159.                 msg += "The current page is either a Property, Tabbed Property, or a Wizard page. ";
  160.                 msg += "These pages only work within frameset's. Normally this error indicates that the call to ";
  161.                 msg += "OTS_CreateTask was made using the incorrect PageType parameter. The correct PageType ";
  162.                 msg += "value this page is either OTS_PT_PROPERTY, OTS_PT_TABBED, or OTS_PT_WIZARD depending upon ";
  163.                 msg += "which page type this page is. ";
  164.                     
  165.                 alert(msg);
  166.             }
  167.             return;
  168.         }
  169.         //
  170.         // Property page
  171.         if ( taskType == "prop" )
  172.         {
  173.             top.footer.location = GetVirtualRoot()+"sh_propfooter.asp";
  174.         }
  175.         //
  176.         // Tabbed Property page
  177.         else if ( taskType == "TabPropSheet" )
  178.         {
  179.             top.footer.location = GetVirtualRoot()+"sh_propfooter.asp";
  180.         }
  181.         //
  182.         // Wizard page
  183.         else if ( taskType == "wizard" )
  184.         {
  185.                 
  186.             if ( wizardPageType == "intro" )
  187.             {
  188.                 top.footer.location = GetVirtualRoot()+"sh_wizardfooter.asp?PT=Intro" +
  189.                                       "&" + SAI_FLD_PAGEKEY + "=" + g_strSAIPageKey;
  190.             }
  191.             else if ( wizardPageType == "finish" )
  192.             {
  193.                 top.footer.location = GetVirtualRoot()+"sh_wizardfooter.asp?PT=Finish" +
  194.                                       "&" + SAI_FLD_PAGEKEY + "=" + g_strSAIPageKey;
  195.             }
  196.             else
  197.             {
  198.                 top.footer.location = GetVirtualRoot()+"sh_wizardfooter.asp?PT=Standard" +
  199.                                       "&" + SAI_FLD_PAGEKEY + "=" + g_strSAIPageKey;
  200.             }
  201.         }
  202.         //
  203.         // Unknown page
  204.         else
  205.         {
  206.             SA_TraceOut("SH_Task::PageInit()", "Unrecognized TaskType: " + taskType);
  207.             top.footer.location = GetVirtualRoot()+"sh_propfooter.asp";
  208.         }
  209.  
  210.         //
  211.         // Wait for the Footer Frameset to load
  212.         SA_WaitForFooter();
  213.  
  214.         //SA_TraceOut("SH_Task::PageInit", "Leaving")
  215.     }
  216.  
  217.     
  218.     //-------------------------------------------------------------------------
  219.     //
  220.     // Function:    CompletePageInit
  221.     //
  222.     // Synopsis:    Finish initialization of the web page running in the client browser.
  223.     //                This function is executed after the Footer Frameset page has 
  224.     //                completed initialization. 
  225.     //
  226.     // Arguments:     None
  227.     //
  228.     // Returns:     None
  229.     //
  230.     //-------------------------------------------------------------------------
  231.     function CompletePageInit() 
  232.     {
  233.         //SA_TraceOut("SH_TASK", "CompletePageInit")
  234.             
  235.         document.onkeypress = HandleKeyPress;           
  236.  
  237.         Task.NavClick = false;
  238.         Task.KeyPress = false;
  239.  
  240.  
  241.         Task.PageType = document.frmTask.PageType.value;
  242.  
  243.         
  244.         //
  245.         // Set initial state of Footer Frameset buttons
  246.         SetTaskButtons();
  247.         
  248.         //
  249.         // Call the Init function for this Web Page. This function must be implemented
  250.         // for any task (Property, Tabbed Property, or Wizard) page.
  251.         var oException;
  252.         try 
  253.         {
  254.             Init();
  255.         }
  256.         catch(oException)
  257.         {
  258.             if ( SA_IsDebugEnabled() ) 
  259.             {
  260.                 alert("Unexpected exception while attempting to execute Init() function.\n\n" +
  261.                     "Error: " + oException.number + "\n" +
  262.                     "Description: " + oException.description + "\n");
  263.             }
  264.         }
  265.  
  266.  
  267.         //
  268.         // Store the initial state of all form fields on this page. The initial state is
  269.         // later checked when the user attempts to tab away from this page. The framework
  270.         // checks to see if any of the form fields have changed and if changes are detected
  271.         // a confirm dialog is presented to warn the user.
  272.         SA_StoreInitialState();
  273.  
  274.         SA_SetPageInitialized();
  275.     }
  276.  
  277.     function SA_IsPageInitialized()
  278.     {
  279.         return bPageInitialized;
  280.     }
  281.     
  282.     function SA_SetPageInitialized()
  283.     {
  284.         bPageInitialized = true;
  285.     }    
  286.     
  287.     //-------------------------------------------------------------------------
  288.     //
  289.     // Function : SetTaskButtons
  290.     //
  291.     // Synopsis : Sets task wizard button state
  292.     //
  293.     // Arguments: None
  294.     //
  295.     // Returns  : None
  296.     //
  297.     //-------------------------------------------------------------------------
  298.  
  299.     function SetTaskButtons()
  300.     {
  301.         var oFooter = top.footer.document.getElementById("frmFooter");
  302.  
  303.         if(oFooter != null)
  304.         {
  305.              switch (document.frmTask.TaskType.value) 
  306.              {
  307.                 case  "wizard" :
  308.                     
  309.                     switch (document.frmTask.PageType.value) 
  310.                         {
  311.                             case "intro": 
  312.                                 if (!Task.NextDisabled)
  313.                                 {
  314.                                     DisableBack();
  315.                                     EnableNext();
  316.                                     oFooter.butNext.focus();
  317.                                 }
  318.                                 break;
  319.                                 
  320.                             case "finish":
  321.                         
  322.                                 if (!Task.FinishDisabled)    
  323.                                 {
  324.                                     EnableFinish();
  325.                                     oFooter.butFinish.focus();
  326.                                 }
  327.                                 break;    
  328.                                 
  329.                             default:
  330.                                 if((document.frmTask.PageType.value).indexOf("finish") !=-1)
  331.                                 {    
  332.                                     if (!Task.FinishDisabled)    
  333.                                     {
  334.                                         EnableFinish();
  335.                                         oFooter.butFinish.focus();
  336.                                     }
  337.                                     
  338.                                 }
  339.                                 else
  340.                                 {
  341.                                     if (!Task.NextDisabled)
  342.                                     {
  343.                                         EnableNext();
  344.                                         oFooter.butNext.focus();
  345.                                     }
  346.                                 }
  347.                                 break;
  348.                         }
  349.                     break;
  350.                         
  351.                default:
  352.                     break;
  353.             }
  354.         }
  355.     }
  356.  
  357.  
  358.     //-------------------------------------------------------------------------
  359.     //
  360.     // Function : SetupEmbedValues
  361.     //
  362.     // Synopsis : Extracts form values for the current embedded page.
  363.     //            Uses values to set current form elements,
  364.     //            e.g., sets a radio button to its state when the page
  365.     //            was last posted.
  366.     //
  367.     // Arguments: None
  368.     //
  369.     // Returns  : None
  370.     //
  371.     //-------------------------------------------------------------------------
  372.     //
  373.     //function SetupEmbedValues() {
  374.     //    var arrName = new Array;
  375.     //    var arrValue = new Array;
  376.     //    var i;
  377.     //    var intIndex = document.frmTask.EmbedPageIndex.value;
  378.     //    var strInput = document.frmTask.elements['EmbedValues'+intIndex].value;
  379.     //    var strNameD = ";;";  // name delimiter
  380.     //    var strValueD = ";";  // value delimiter
  381.     //    if (strInput != "") {
  382.     //        if (strInput.substring(0, 2) == strNameD)
  383.     //            strInput = strInput.substring(2, strInput.length + 1);
  384.     //        intIndex = 0;
  385.     //        intPos1 = strInput.indexOf(strValueD);
  386.     //        intPos2 = -2;
  387.     //        do {
  388.     //            arrName[intIndex] = Trim(strInput.substring(intPos2+2, intPos1));
  389.     //            intPos2 = strInput.indexOf(strNameD, intPos1);
  390.     //            if (intPos2 == -1)
  391.     //                intPos2 = strInput.length + 1;    // assumes no end delimiter
  392.     //            arrValue[intIndex] = Trim(strInput.substring(intPos1+1, intPos2));
  393.     //            if (intPos2+1 < strInput.length)
  394.     //                intPos1 = strInput.indexOf(strValueD, intPos2 + 2);
  395.     //            else
  396.     //                break;
  397.     //            intIndex = intIndex+1;
  398.     //        }
  399.     //        while (intPos1 != 0);
  400.     //        for (i=0;i<arrName.length;i++) {
  401.     //            if (document.frmTask.elements[arrName[i]] != null)
  402.     //                document.frmTask.elements[arrName[i]].value = arrValue[i];
  403.     //        }
  404.     //    }
  405.     //}
  406.     
  407.     
  408.  
  409.     //-------------------------------------------------------------------------
  410.     //
  411.     // Function : HandleKeyPress
  412.     //
  413.     // Synopsis : Event handler for key presses
  414.     //
  415.     // Arguments: evnt(IN) - event describing the key pressed
  416.     //
  417.     // Returns  : None
  418.     //
  419.     //-------------------------------------------------------------------------
  420.  
  421.     function HandleKeyPress(evnt) {
  422.  
  423.         var intKeyCode;                
  424.         var    Task1 = top.main.Task
  425.  
  426.         if (Task1 == null)
  427.         {
  428.             return;
  429.         }
  430.  
  431.         if (Task1.KeyPress==true || Task1.NavClick==true) {
  432.             return;
  433.         }
  434.         
  435.         if (IsIE())
  436.             intKeyCode = window.event.keyCode;
  437.         else
  438.             intKeyCode = evnt.which;
  439.  
  440.         if (intKeyCode == 13) 
  441.         {
  442.             //alert("HandleKeyPress ENTER key logic");
  443.             Task1.KeyPress = true;
  444.             if (Task1.PageType != "finish") {
  445.                 if(document.all && (top.footer.frmFooter.butOK !=null ||top.footer.frmFooter.butNext !=null))
  446.                     top.main.Next();
  447.                 if (document.layers && (parent.frames[1].window.document.layers[0].document.forms[0].elements[1] != null || parent.frames[1].window.document.layers[2].document.forms[0].elements[1] != null))                
  448.                     top.main.Next();
  449.             } else {
  450.                 if(document.all && (top.footer.frmFooter.butFinish!=null))
  451.                     top.main.FinishShell();
  452.                 if (document.layers && parent.frames[1].window.document.layers[1].document.forms[0].elements[1] != null)
  453.                     top.main.FinishShell();
  454.             }
  455.         }
  456.         
  457.         if (intKeyCode == 27) 
  458.         {
  459.             Task1.KeyPress = true;
  460.             top.main.Cancel();
  461.         }
  462.  
  463.         //
  464.         // JK - 2-6-01 Removed
  465.         //if ( (intKeyCode==98 ||intKeyCode==66) && Task1.PageType == "standard")//key code for "B"
  466.         //{
  467.         //    Task1.KeyPress = true;
  468.         //    top.main.Back();
  469.         //}
  470.         //if ( (intKeyCode==110 ||intKeyCode==78) && (Task1.PageType == "intro" ||Task1.PageType == "standard"))//key code for "N"
  471.         //{
  472.         //    Task1.KeyPress = true;
  473.         //    top.main.Next();
  474.         //}
  475.         //if ((intKeyCode==102 ||intKeyCode==70) && Task1.PageType == "finish")//key code for "F"
  476.         //{
  477.         //    Task1.KeyPress = true;
  478.         //    top.main.FinishShell();
  479.         //}
  480.     }
  481.  
  482.     //-------------------------------------------------------------------------
  483.     //
  484.     // Function : DisplayErr
  485.     //
  486.     // Synopsis : Display error msg
  487.     //
  488.     // Arguments: ErrMsg(IN) - error msg to display
  489.     //
  490.     // Returns  : None
  491.     //
  492.     //-------------------------------------------------------------------------
  493.     function SA_DisplayErr(ErrMsg) {
  494.         DisplayErr(ErrMsg);
  495.     }
  496.     
  497.     function DisplayErr(ErrMsg) {
  498.         var strErrMsg = '<table class="ErrMsg"><tr><td><img src="' + VirtualRoot + 'images/critical_error.gif" border=0></td><td>' + ErrMsg + '</td></tr></table>'
  499.         if (IsIE()) {
  500.             document.all("divErrMsg").innerHTML = strErrMsg;
  501.         }
  502.         else {
  503.             alert(ErrMsg);
  504.         }
  505.     }
  506.  
  507.  
  508.     function SA_OnClickTab(tabNumber)
  509.     {
  510.         var oException;
  511.         var bValid = false;
  512.         try
  513.         {
  514.             bValid = ValidatePage();
  515.                 
  516.         }
  517.         catch(oException)
  518.         {
  519.             if ( SA_IsDebugEnabled() )
  520.             {
  521.                 alert("Unexpected exception while attempting to execute ValidatePage()\n\nError:"+oException.number+"\nDescription: " + oException.description);
  522.             }
  523.         }
  524.         
  525.         if (bValid) 
  526.         {
  527.             try
  528.             {
  529.                 SetData(); 
  530.             }
  531.             catch(oException)
  532.             {
  533.                 if ( SA_IsDebugEnabled() )
  534.                 {
  535.                     alert("Unexpected exception while attempting to execute SetData()\n\nError:"+oException.number+"\nDescription: " + oException.description);
  536.                 }
  537.             }
  538.             
  539.             top.main.document.forms['frmTask'].TabSelected.value=tabNumber; 
  540.             top.main.document.forms['frmTask'].submit();
  541.         }
  542.         
  543.     }
  544.     
  545.  
  546.     //-------------------------------------------------------------------------
  547.     //
  548.     // Function : Next
  549.     //
  550.     // Synopsis : Handle next button being clicked
  551.     //
  552.     // Arguments: None
  553.     //
  554.     // Returns  : None
  555.     //
  556.     //-------------------------------------------------------------------------
  557.     function Next() {
  558.         if (Task.NavClick != true && !Task.NextDisabled) {
  559.             var bValid;
  560.  
  561.             try {
  562.                 bValid = ValidatePage();
  563.                 if (bValid) {
  564.                     DisableNext();
  565.                     DisableBack();
  566.                     DisableCancel();
  567.                     DisableFinish();
  568.                     DisableOK();
  569.                     Task.NavClick = true;                
  570.                     SetData();
  571.                     document.frmTask.Method.value = "NEXT";
  572.                     document.frmTask.submit();
  573.                     return true;
  574.                 }
  575.                 else {
  576.                     Task.NavClick = false;
  577.                     Task.KeyPress = false;
  578.                     return false;
  579.                 }
  580.             }
  581.             catch(oException)
  582.             {
  583.                 if ( SA_IsDebugEnabled() )
  584.                 {
  585.                     alert("Unexpected exception while attempting to execute ValidatePage()\n\nError:"+oException.number+"\nDescription: " + oException.description);
  586.                 }
  587.             }
  588.             
  589.         }
  590.         else {
  591.             return false;
  592.         }
  593.     }
  594.  
  595.  
  596.     //-------------------------------------------------------------------------
  597.     //
  598.     // Function : Back
  599.     //
  600.     // Synopsis : Handle back button being clicked
  601.     //
  602.     // Arguments: None
  603.     //
  604.     // Returns  : None
  605.     //
  606.     //-------------------------------------------------------------------------
  607.  
  608.     function Back() {
  609.         if (Task.NavClick == false && Task.PageType != "intro" && !Task.BackDisabled) {    
  610.             DisableNext();
  611.             DisableBack();
  612.             DisableCancel();
  613.             DisableFinish();
  614.             DisableOK();
  615.             Task.NavClick = true;
  616.             document.frmTask.Method.value = "BACK";
  617.             document.frmTask.submit();
  618.         }
  619.     }
  620.  
  621.  
  622.     //-------------------------------------------------------------------------
  623.     //
  624.     // Function : Cancel
  625.     //
  626.     // Synopsis : Handle cancel button being clicked
  627.     //
  628.     // Arguments: None
  629.     //
  630.     // Returns  : None
  631.     //
  632.     //-------------------------------------------------------------------------
  633.  
  634.     function Cancel() {
  635.         
  636.         if (Task.NavClick != true && !Task.CancelDisabled) {
  637.             Task.NavClick = true;
  638.             DisableCancel();
  639.             DisableNext();
  640.             DisableBack();
  641.             DisableFinish();
  642.             DisableOK();
  643.             document.frmTask.target= "_top";
  644.             document.frmTask.Method.value = "CANCEL";
  645.             document.frmTask.submit();
  646.         }
  647.     }
  648.  
  649.  
  650.     //-------------------------------------------------------------------------
  651.     //
  652.     // Function : FinishShell
  653.     //
  654.     // Synopsis : Handle finish button being clicked
  655.     //
  656.     // Arguments: None
  657.     //
  658.     // Returns  : None
  659.     //
  660.     //-------------------------------------------------------------------------
  661.  
  662.     function FinishShell() {
  663.         
  664.         if (Task.NavClick == false && !Task.FinishDisabled) {
  665.             Task.NavClick = true;
  666.             DisableCancel();
  667.             DisableNext();
  668.             DisableBack();
  669.             DisableFinish();
  670.             DisableOK();
  671.             SetData();
  672.             document.frmTask.Method.value = "FINISH";
  673.             document.frmTask.submit();
  674.         }
  675.     }
  676.     
  677.  
  678.     //-------------------------------------------------------------------------
  679.     //
  680.     // Function : DisableNext
  681.     //
  682.     // Synopsis : Disables the next button 
  683.     //
  684.     // Arguments: None
  685.     //
  686.     // Returns  : None
  687.     //
  688.     //-------------------------------------------------------------------------
  689.     function SA_DisableNext() 
  690.     {
  691.         DisableNext();
  692.     }
  693.  
  694.     function DisableNext() {
  695.         var oFooter = SAI_GetFooterForm('DisableNext();');
  696.         if ( oFooter == null ) return;
  697.  
  698.           if (oFooter.butNext != null)
  699.         {
  700.             oFooter.butNext.disabled = true;
  701.             oFooter.butNext.value = oFooter.butNext.value;
  702.  
  703.             var oImage = top.footer.document.getElementById("btnNextImage");
  704.             if ( oImage != null )
  705.             {
  706.                 oImage.src = GetVirtualRoot()+'images/butGreenArrowDisabled.gif';
  707.             }
  708.         }
  709.         
  710.         Task.NextDisabled = true;
  711.     }
  712.  
  713.  
  714.     //-------------------------------------------------------------------------
  715.     //
  716.     // Function : EnableNext
  717.     //
  718.     // Synopsis : Enables the next button 
  719.     //
  720.     // Arguments: None
  721.     //
  722.     // Returns  : None
  723.     //
  724.     //-------------------------------------------------------------------------
  725.     function SA_EnableNext()
  726.     {
  727.         EnableNext();
  728.     }
  729.     
  730.     function EnableNext() {
  731.         var oFooter = SAI_GetFooterForm('EnableNext();');
  732.         if ( oFooter == null ) return;
  733.         
  734.          if (oFooter.butNext != null)
  735.         {
  736.             oFooter.butNext.disabled = false;        
  737.             var oImage = top.footer.document.getElementById("btnNextImage");
  738.             if ( oImage != null )
  739.             {
  740.                 oImage.src = GetVirtualRoot()+'images/butGreenArrow.gif';
  741.             }
  742.         }
  743.         Task.NextDisabled = false;
  744.     }
  745.  
  746.  
  747.     //-------------------------------------------------------------------------
  748.     //
  749.     // Function : DisableBack
  750.     //
  751.     // Synopsis : Disables the back button 
  752.     //
  753.     // Arguments: None
  754.     //
  755.     // Returns  : None
  756.     //
  757.     //-------------------------------------------------------------------------
  758.     function SA_DisableBack()
  759.     {
  760.         DisableBack();
  761.     }
  762.     
  763.     function DisableBack() {
  764.         var oFooter = SAI_GetFooterForm('DisableBack();');
  765.         if ( oFooter == null ) return;
  766.         
  767.         if (oFooter.butBack != null)
  768.         {
  769.             oFooter.butBack.disabled = true;    
  770.             oFooter.butBack.value = oFooter.butBack.value;
  771.             
  772.             var oImage = top.footer.document.getElementById("btnBackImage");
  773.             if ( oImage != null )
  774.             {
  775.                 oImage.src = GetVirtualRoot()+'images/butGreenArrowLeftDisabled.gif';
  776.             }
  777.             
  778.         }
  779.         Task.BackDisabled = true;
  780.     }
  781.  
  782.  
  783.     //-------------------------------------------------------------------------
  784.     //
  785.     // Function : EnableBack
  786.     //
  787.     // Synopsis : Enables the back button 
  788.     //
  789.     // Arguments: None
  790.     //
  791.     // Returns  : None
  792.     //
  793.     //-------------------------------------------------------------------------
  794.     function SA_EnableBack()
  795.     {
  796.         EnableBack();
  797.     }
  798.     
  799.     function EnableBack() {
  800.         var oFooter = SAI_GetFooterForm('EnableBack();');
  801.         if ( oFooter == null ) return;
  802.         
  803.         if (oFooter.butBack != null)
  804.         {
  805.             oFooter.butBack.disabled = false;        
  806.             var oImage = top.footer.document.getElementById("btnBackImage");
  807.             if ( oImage != null )
  808.             {
  809.                 oImage.src = GetVirtualRoot()+'images/butGreenArrowLeft.gif';
  810.             }
  811.         }
  812.         Task.BackDisabled = false;
  813.     }
  814.  
  815.  
  816.     //-------------------------------------------------------------------------
  817.     //
  818.     // Function : DisableFinish
  819.     //
  820.     // Synopsis : Disables the finish button 
  821.     //
  822.     // Arguments: None
  823.     //
  824.     // Returns  : None
  825.     //
  826.     //-------------------------------------------------------------------------
  827.     function SA_DisableFinish()
  828.     {
  829.         DisableFinish();
  830.     }
  831.     
  832.     function DisableFinish() {
  833.         var oFooter = SAI_GetFooterForm('DisableFinish();');
  834.         if ( oFooter == null ) return;
  835.         
  836.         if (oFooter.butFinish != null)
  837.         {
  838.             oFooter.butFinish.disabled = true;
  839.             oFooter.butFinish.value = oFooter.butFinish.value;
  840.             
  841.             var oImage = top.footer.document.getElementById("btnFinishImage");
  842.             if ( oImage != null )
  843.             {
  844.                 oImage.src = GetVirtualRoot()+'images/butGreenArrowDisabled.gif';
  845.             }
  846.             
  847.         }
  848.         Task.FinishDisabled = true;
  849.     }
  850.  
  851.  
  852.     //-------------------------------------------------------------------------
  853.     //
  854.     // Function : EnableFinish
  855.     //
  856.     // Synopsis : Enables the finish button 
  857.     //
  858.     // Arguments: None
  859.     //
  860.     // Returns  : None
  861.     //
  862.     //-------------------------------------------------------------------------
  863.     function SA_EnableFinish()
  864.     {
  865.         EnableFinish();
  866.     }
  867.     
  868.     function EnableFinish() {
  869.         var oFooter = SAI_GetFooterForm('EnableFinish();');
  870.         if ( oFooter == null ) return;
  871.         
  872.         if (oFooter.butFinish != null)
  873.         {
  874.             oFooter.butFinish.disabled = false;        
  875.             var oImage = top.footer.document.getElementById("btnFinishImage");
  876.             if ( oImage != null )
  877.             {
  878.                 oImage.src = GetVirtualRoot()+'images/butGreenArrow.gif';
  879.             }
  880.         }
  881.         Task.FinishDisabled = false;
  882.     }
  883.  
  884.  
  885.     //-------------------------------------------------------------------------
  886.     //
  887.     // Function : DisableCancel
  888.     //
  889.     // Synopsis : Disables the cancel button 
  890.     //
  891.     // Arguments: None
  892.     //
  893.     // Returns  : None
  894.     //
  895.     //-------------------------------------------------------------------------
  896.     function SA_DisableCancel()
  897.     {
  898.         DisableCancel();
  899.     }
  900.     
  901.     function DisableCancel() {
  902.         var oFooter = SAI_GetFooterForm('DisableCancel();');
  903.         if ( oFooter == null ) return;
  904.         
  905.         if (oFooter.butCancel != null)
  906.         {    
  907.             oFooter.butCancel.disabled = true;
  908.             oFooter.butCancel.value = oFooter.butCancel.value;
  909.             
  910.             var oImage = top.footer.document.getElementById("btnCancelImage");
  911.             if ( oImage != null )
  912.             {
  913.                 oImage.src = GetVirtualRoot()+'images/butRedXDisabled.gif';
  914.             }
  915.         }
  916.         Task.CancelDisabled = true;
  917.     }
  918.  
  919.  
  920.     //-------------------------------------------------------------------------
  921.     //
  922.     // Function : EnableCancel
  923.     //
  924.     // Synopsis : Enables the cancel button 
  925.     //
  926.     // Arguments: None
  927.     //
  928.     // Returns  : None
  929.     //
  930.     //-------------------------------------------------------------------------
  931.     function SA_EnableCancel()
  932.     {
  933.         EnableCancel();
  934.     }
  935.     
  936.     function EnableCancel() {
  937.         var oFooter = SAI_GetFooterForm('EnableCancel();');
  938.         if ( oFooter == null ) return;
  939.         
  940.         
  941.          if (oFooter.butCancel != null) 
  942.         {
  943.             oFooter.butCancel.disabled = false;
  944.             var oImage = top.footer.document.getElementById("btnCancelImage");
  945.             if ( oImage != null )
  946.             {
  947.                 oImage.src = GetVirtualRoot()+'images/butRedX.gif';
  948.             }
  949.         }
  950.         Task.CancelDisabled = false;
  951.     }
  952.  
  953.  
  954.     //-------------------------------------------------------------------------
  955.     //
  956.     // Function : DisableOK
  957.     //
  958.     // Synopsis : Disables the OK button 
  959.     //
  960.     // Arguments: None
  961.     //
  962.     // Returns  : None
  963.     //
  964.     //-------------------------------------------------------------------------
  965.     function SA_DisableOK()
  966.     {
  967.         DisableOK();
  968.     }
  969.     
  970.     function DisableOK() {
  971.         var oFooter = SAI_GetFooterForm('DisableOK();');
  972.         if ( oFooter == null ) return;
  973.  
  974.          if (oFooter.butOK != null)
  975.         {
  976.             oFooter.butOK.disabled = true;
  977.             oFooter.butOK.value = oFooter.butOK.value;
  978.             
  979.             var oImage = top.footer.document.getElementById("btnOKImage");
  980.             if ( oImage != null )
  981.             {
  982.                 oImage.src = GetVirtualRoot()+'images/butGreenArrowDisabled.gif';
  983.             }
  984.         }
  985.         Task.FinishDisabled = true;
  986.     }
  987.  
  988.  
  989.     //-------------------------------------------------------------------------
  990.     //
  991.     // Function : EnableOK
  992.     //
  993.     // Synopsis : Enables the OK button 
  994.     //
  995.     // Arguments: None
  996.     //
  997.     // Returns  : None
  998.     //
  999.     //-------------------------------------------------------------------------
  1000.     function SA_EnableOK()
  1001.     {
  1002.         EnableOK();
  1003.     }
  1004.     
  1005.     function EnableOK() {
  1006.         var oFooter = SAI_GetFooterForm('EnableOK();');
  1007.         if ( oFooter == null ) return;
  1008.         
  1009.          if (oFooter.butOK != null)        
  1010.         {
  1011.             oFooter.butOK.disabled = false;        
  1012.             var oImage = top.footer.document.getElementById("btnOKImage");
  1013.             if ( oImage != null )
  1014.             {
  1015.                 oImage.src = GetVirtualRoot()+'images/butGreenArrow.gif';
  1016.             }
  1017.         }
  1018.         Task.NextDisabled = false;
  1019.     }
  1020.  
  1021.  
  1022.     //-------------------------------------------------------------------------
  1023.     //
  1024.     // Function : isValidFileName
  1025.     //
  1026.     // Synopsis : validates that file name has correct syntax 
  1027.     //
  1028.     // Arguments: filePath(IN) - file name with path to validate
  1029.     //
  1030.     // Returns  : true/false
  1031.     //
  1032.     //-------------------------------------------------------------------------
  1033.  
  1034.     function isValidFileName(filePath)
  1035.     {
  1036.         reInvalid = /[\/\*\?"<>\|]/;
  1037.         if (reInvalid.test(filePath))
  1038.             return false;
  1039.                 
  1040.         reColomn2 = /:{2,}/;
  1041.         reColomn1 = /:{1,}/;
  1042.         if ( reColomn2.test(filePath) || ( filePath.charAt(1) != ':' && reColomn1.test(filePath) ))
  1043.             return false;
  1044.             
  1045.         reEndSlash = /\\ *$/;
  1046.         if (reEndSlash.test(filePath))
  1047.             return false;
  1048.                 
  1049.         reEndColomn = /: *$/;
  1050.         if (reEndColomn.test(filePath))
  1051.             return false;
  1052.             
  1053.         reAllSpaces = /[^ ]/;
  1054.         if (!reAllSpaces.test(filePath))
  1055.             return false;
  1056.  
  1057.         return true;
  1058.     }
  1059.  
  1060.     //-------------------------------------------------------------------------
  1061.     //
  1062.     // Function : HandleKeyPressIFrame
  1063.     //
  1064.     // Synopsis : key press event handler for IFRAME 
  1065.     //
  1066.     // Arguments: evnt(IN) - event describing the key pressed
  1067.     //
  1068.     // Returns  : None
  1069.     //
  1070.     //-------------------------------------------------------------------------
  1071.  
  1072.     function HandleKeyPressIFrame(evnt) {
  1073.         var intKeyCode;
  1074.         var frameMain = window.top.main;
  1075.         
  1076.         if (Task.KeyPress==true || Task.NavClick==true) {
  1077.             return;
  1078.         }
  1079.                 
  1080.         Task.KeyPress = true;
  1081.         
  1082.         if (IsIE())
  1083.             intKeyCode = window.event.keyCode;
  1084.         else
  1085.             intKeyCode = evnt.which;
  1086.         
  1087.         
  1088.         if (intKeyCode == 13) 
  1089.         {
  1090.             frameMain.Next();
  1091.         }
  1092.         if (intKeyCode == 27) {
  1093.             frameMain.Cancel();
  1094.         }
  1095.     }
  1096.  
  1097.     function IsOkayToChangeTabs()
  1098.     {
  1099.         return confirm('Click OK to discard any changes.');
  1100.          
  1101.     }
  1102.  
  1103.  
  1104.     function SAI_GetFooterForm(CallingFunction)
  1105.     {
  1106.         var oFooter = top.footer.document.getElementById("frmFooter");
  1107.         if (oFooter == null) {
  1108.             
  1109.             retrys++;
  1110.             if ( retrys < maxRetrys ) {
  1111.                 //SA_TraceOut("SH_TASK::DisableNext()", "Footer not ready, waiting for footer")
  1112.                 window.setTimeout(CallingFunction,500);
  1113.             }
  1114.             else {
  1115.                 if (SA_IsDebugEnabled())
  1116.                 {
  1117.                     SA_TraceOut("Unable to locate footer.frmFooter for function: ", CallingFunction);
  1118.                 }
  1119.                 retrys = 0;
  1120.             }
  1121.         }
  1122.         else
  1123.         {
  1124.             retrys = 0;
  1125.         }
  1126.         return oFooter;
  1127.     
  1128.     
  1129.     }
  1130.     
  1131.     
  1132.